﻿using System;
namespace HBFramework
{
    /// <summary>
    /// Update计时器
    /// </summary>
    public class UpdateTimer : ITimer
    {
        private readonly Action onUpdate;
        private readonly Action onRelease;
        bool ITimer.IsStop => false;

        public UpdateTimer(Action onUpdate, Action onRelease)
        {
            this.onUpdate = onUpdate;
            this.onRelease = onRelease;
        }

        void ITimer.OnStart()
        {
            
        }

        void ITimer.OnUpdate()
        {
            onUpdate?.Invoke();
        }

        void ITimer.OnStop()
        {
            onRelease?.Invoke();
        }
    }
}
